function yields_cu = getYields(model,x_cu)

[nn,T] = size(x_cu);
if nn > T
    x_cu = x_cu';
    [nn,T] = size(x_cu);
end
maxMaturity  = size(model.by0,1);
yields_cu    = zeros(maxMaturity,T);
if model.pruningOn == 1
    xf_cu  = x_cu(1:model.nx,:);
    if model.appOrder > 1
        xs_cu = zeros(model.nx,T);
        xs_cu(1:model.nx1,:) = x_cu(model.nx+1:model.nx+model.nx1,:);
    end
    if  model.appOrder > 2
        xrd_cu = zeros(model.nx,T);
        xrd_cu(1:model.nx1,:) = x_cu(model.nx+model.nx1+1:model.nx+2*model.nx1,:);
    end
    for t=1:T
        if model.appOrder == 1
            yields_cu(:,t) = model.by0 + model.byx*xf_cu(:,t);
        elseif model.appOrder == 2
            xfxf_cu = kron3(xf_cu(:,t),xf_cu(:,t));
            yields_cu(:,t) = model.by0 + model.byx*(xf_cu(:,t)+xs_cu(:,t)) + model.Byxx*xfxf_cu + 0.5*model.byss;
        elseif model.appOrder == 3
            xfxf_cu = kron3(xf_cu(:,t),xf_cu(:,t));
            xfxs_cu = kron3(xs_cu(:,t),xf_cu(:,t));
            yields_cu(:,t) = model.by0 + model.byx*(xf_cu(:,t)+xs_cu(:,t)+xrd_cu(:,t)) ...
                + model.Byxx*(xfxf_cu + 2*xfxs_cu) + model.Byxxx*kron3(xfxf_cu,xf_cu(:,t)) ...
                + 0.5*model.byss + 3/6*model.byssx*xf_cu(:,t);
        end
    end        
else
    for t=1:T
        yields_cu(:,t) = model.by0 + model.byx*x_cu(:,t);
        if model.appOrder > 1
            xx_cu = kron3(x_cu(:,t),x_cu(:,t));
            yields_cu(:,t) = yields_cu(:,t) + model.Byxx*xx_cu + 0.5*model.byss;
        end
        if model.appOrder > 2
            yields_cu(:,t) = yields_cu(:,t) + model.Byxxx*kron3(xx_cu,x_cu(:,t)) + 3/6*model.byssx*x_cu(:,t);
        end
    end
end

end